<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class RegisterWidget extends CWidget {
    
    private $mo;
    
    public function init() {

        $model = new User;
//      var_dump($modle);
//        exit;
        if (isset($_POST['User'])) {
            $model->attributes = $_POST['User'];
//                        var_dump($model->attributes);
//                        exit;
            if ($model->save())
                Yii::app()->getRequest()->redirect('index.php?r=news/index');
        }
        $this->mo = $model;
       
        
    }

    public function run() {
        $this->render('register', array(
        'model' => $this->mo,
        ));
    }

}
